package com.addplus.townmall.server.api.mapper.town;

import com.addplus.townmall.server.api.model.town.BasicGuarantee;
import com.addplus.townmall.server.api.model.town.ShopBasicGuarantee;
import com.addplus.townmall.server.api.utils.BaseAddMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 商城商品基础保障关联表 Mapper 接口
 * </p>
 *
 * @author zhangjiehang
 * @since 2018-08-27
 */
public interface ShopBasicGuaranteeMapper extends BaseAddMapper<ShopBasicGuarantee> {

    @Select("SELECT bg.id,bg.name,bg.introduction,bg.icon FROM basic_guarantee bg LEFT JOIN shop_basic_guarantee sbg ON sbg.basic_guarantee_id = bg.id WHERE\n" +
            "sbg.shop_id = #{shopProductId} AND bg.is_deleted=0 AND sbg.is_deleted = 0 ORDER BY bg.sort desc")
    List<BasicGuarantee> getShopProductBasicGuaranteeList(@Param("shopProductId") Integer shopProductId);

}
